package scjp.preparation.file;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;

public class PathCompare {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Path path1 = Paths.get("Test");
		Path path2 = Paths
				.get("C:\\Dev\\Projects\\MyProjects\\yev-playground\\Test");

		if(Files.isDirectory(path1, LinkOption.NOFOLLOW_LINKS)) {
			System.out.println(path1.getFileName() + " is a directory");
			}
			else {
			System.out.println(path1.getFileName() + " is a file");
			}
//		try {
//			System.out.println(path1.toAbsolutePath());
//			System.out.println(path2.toAbsolutePath());
//			System.out.println("path1.equals(path2) is: " + path1.equals(path2));
//			System.out.println("path2.equals(path1.toAbsolutePath()) is "
//					+ path2.equals(path1.toAbsolutePath()));
//			System.out.println("Compare files: " + Files.isSameFile(path1, path2));
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}

}
